package org.example.chapter2;

import java.util.Scanner;

public class AdditionQuiz {
    public static void main(String[] args) {
        int number1 = (int)(System.currentTimeMillis()%10);
        int number2 = (int)(System.currentTimeMillis()/10%10);

        Scanner input = new Scanner(System.in);
        System.out.print("What is "+number1+" and "+number2+"? ");
//        int answer = input.nextInt();
        int answer;
        do{
             answer = input.nextInt();
             if(answer == number1 + number2){
                 System.out.println("right");
                 break;
             }else{
                 System.out.println("wrong");
                 System.out.println("try again");
             }
        }while(true);

//        boolean correct = answer == number1 + number2;
//        if (correct){
//            System.out.println("Correct!");
//        }
//        while(!correct) {
//            System.out.println("no");
//            System.out.println("please try again");
//            answer = input.nextInt();
//            correct = answer == number1 + number2;
//        }
//        System.out.println("right");




//        if(answer == number1 + number2) {
//            System.out.println("Yes");
//        }else{
//            System.out.println("No");
//        }

    }
}
